<template>
	<view class="container">
		<u-modal v-model="showModal1" :title="title" :confirm-text="confirmText" :cancel-text="cancelText" :cancel-color="cancelColor" :confirm-color="confirmColor" :show-cancel-button="cancelButton" :content="content" @confirm="confirm" @cancel="cancel"></u-modal>
		<u-modal v-model="showModal2" :title="title" :confirm-text="confirmText" :cancel-text="cancelText" :cancel-color="cancelColor" :confirm-color="confirmColor" :show-cancel-button="cancelButton" @confirm="confirm" @cancel="cancel">
			<view class="c-tc o-p-b c-t75" style="color: #606266;">
				<rich-text :nodes="content"></rich-text>
			</view>
		</u-modal>
	</view>
</template>

<script>
	export default {
		name: "authorize",
		data() {
			return {
				showModal1: this.show1,
				showModal2: this.show2,
			};
		},
		props:{
			show1: {
				type: Boolean,
				default: true,
			},
			show2: {
				type: Boolean,
				default: false,
			},
			//是否显示取消按钮
			cancelButton: {
				type: Boolean,
				default: true,
			},
			//显示提示内容
			content: {
				type: String,
				default: '这里是提示的内容',
			},
			// 标题
			title: {
				type: String,
				default: '提示',
			},
			// 确认按钮的文字
			confirmText: {
				type: String,
				default: '确认',
			},
			//确认按钮的颜色
			confirmColor: {
				type: String,
				default: '#2979ff',
			},
			// 取消按钮的文字
			cancelText: {
				type: String,
				default: '取消',
			},
			//取消按钮的颜色
			cancelColor: {
				type: String,
				default: '#606266',
			}
		},
		
		computed: {
			// showModal1: {
			// 	// getter
			// 	get: function () {
			// 		console.log('this ==>', this)
			// 		return this.show1
			// 	},
			// 	// setter
			// 	set: function (newValue) {
			// 		return newValue
			// 	}
				
			// }
			// showModal2: () => {return this.show2}
		},
		watch:{
			'show1': function (val,oval) {
				// console.log(val,oval);
				this.showModal1 = val;
			},
			'show2': function (val,oval) {
				// console.log(val,oval);
				this.showModal2 = val;
			}
		},
		mounted() {
			// this.showModal1 = this.show1;
			// this.showModal2 = this.show2
		},
		methods:{
			confirm() {
				this.$emit('confirm', false);
			},
			cancel() {
				this.$emit('cancel', false)
			}
		}
	}
</script>

<style>
</style>
